<?php
require_once ROOT_ADMIN_MODELS.DS.'Models_Base.php';
class Models_Log_File extends Models_Base{		    
    public function __construct(){
    	parent::__construct();
    	$this->_key="id";
    	$this->_table="log";
       // $this->db=Zend_Registry::get('db');
    }
    public function listLog($from,$to)
    {
       	$sql="SELECT 
       	 			log.id id,log.actionDate date,log.action action,log.note note,`user`.userName name 
       	 		FROM 
       	 			`log` LEFT JOIN `user` 	ON(log.user_id=user.id) 
       	 		WHERE 1 ";
       	if($from != "")
       	 	$sql .= " AND actionDate >= '$from'";
       	if($to !="")
       		$sql .= " AND actionDate <= '$to'";
		$sql .=" ORDER BY 
					 log.id ASC
             ";
        $data=$this->_db->fetchAll($sql,null,Zend_Db::FETCH_OBJ);
        return $data;
    }
   
}
	